home *** CD-ROM | disk | FTP | other *** search
- TRIMLEN(3F) Last changed: 3-3-97
-
-
- NNAAMMEE
- TTRRIIMMLLEENN - Returns the length of a character argument without counting
- trailing blanks
-
- SSYYNNOOPPSSIISS
- IINNTTEEGGEERR _t_r_i_m_l_e_n
- _i_n_t_l_e_n == TTRRIIMMLLEENN((_s_t_r_i_n_g))
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- UNICOS, UNICOS/mk, and IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- TTRRIIMMLLEENN is an integer function that returns the length of a character
- argument without counting the trailing blanks. The function must be
- declared as type integer in the calling routine. The _s_t_r_i_n_g argument
- must be of type character.
-
- This function is intended for use as part of the substring notation.
- Examples 2 and 3 show the TTRRIIMMLLEENN function used in this manner. The
- value of each of the parts of the substring notation must be as
- follows:
-
- 1 <= _l_e_f_t_m_o_s_t_p_o_s <= _r_i_g_h_t_m_o_s_t_p_o_s <= _s_t_r_i_n_g_l_e_n_g_t_h
-
- _l_e_f_t_m_o_s_t_p_o_s is the leftmost character position in the substring,
- _r_i_g_h_t_m_o_s_t_p_o_s is the rightmost character position in the substring, and
- _s_t_r_i_n_g_l_e_n_g_t_h is the declared length of the character entity. TTRRIIMMLLEENN
- returns a value of 1 for a string of all blanks.
-
- EEXXAAMMPPLLEESS
- Example 1: A program using the function TTRRIIMMLLEENN could do the
- following:
-
- INTEGER TRIMLEN
- CHARACTER*80 STRING
- STRING = ' '
- STRING(20:47) = 'TEST TRIMLEN LENGTH RETURNED'
- INTLEN = TRIMLEN(STRING)
- WRITE(6,1) INTLEN, STRING(1:INTLEN)
- 1 FORMAT(' LENGTH=',I5,' STRING=',A,'-DONE')
- PRINT 2,'12345678901234567890123456789012345678901234567890'
- 2 FORMAT(21X,A)
- END
-
- The output of the program is as follows:
-
- LENGTH= 47 STRING= TEST TRIMLEN LENGTH RETURNED-DONE
- 12345678901234567890123456789012345678901234567890
-
- Example 2: This example produces a string with the character <<
- written following the last nonblank character of SSTTRRIINNGG:
-
- WRITE(6,901)STRING(1:TRIMLEN(STRING))
- 901 FORMAT(' The string is >',A,'<')
-
- Example 3: In this example, although NNEEWW may have trailing blanks,
- the character << is written after the last nonblank character in
- SSTTRRIINNGG:
-
- NEW = STRING(1:TRIMLEN(STRING)) // '< The end'
-
- SSEEEE AALLSSOO
- _A_p_p_l_i_c_a_t_i_o_n _P_r_o_g_r_a_m_m_e_r'_s _L_i_b_r_a_r_y _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, publication SR-
- 2165, for the printed version of this man page.
-